import ajax from "./ajax";

export const BASE_URL = 'http://localhost:7001';
// export const BASE_URL = 'http://test.goutclass.top/';

// const ADMIN_URL = `${BASE_URL}`;
//上传文件
export const uploadFile = data => ajax(BASE_URL + '/uploadFile', data, 'post', 'file');

//管理员登录
export const adminLogin = data => ajax(BASE_URL + '/admin/adminLogin', data, 'post');


//自行车列表
export const bikeList = (data) => ajax(BASE_URL + '/bike/getAllBikes', data, 'get');

//添加自行车
export const addBike = data => ajax(BASE_URL + '/bike/addBike', data, 'post', "json");

//修改自行车
export const reviseBike = data => ajax(BASE_URL + '/bike/reviseBike', data, 'post', "json");
//删除自行车
export const delBike = data => ajax(BASE_URL + '/bike/delBike', data, 'post', "json");


//文章列表
export const getArticles = (data) => ajax(BASE_URL + '/article/getArticles', data, 'get');
export const getArticleDetail = (data) => ajax(BASE_URL + '/article/getArticleDetail', data, 'get');

//添加文章
export const addArticle = data => ajax(BASE_URL + '/article/addArticle', data, 'post', "json");

//添加文章
export const reviseArticle = data => ajax(BASE_URL + '/article/reviseArticle', data, 'post', "json");
//删除文章
export const delArticle = data => ajax(BASE_URL + '/article/delArticle', data, 'post', "json");

//管理员获取所以用户
export const getAllUsers = (data) => ajax(BASE_URL + '/user/getAllUsers', data, 'get');
//删除user
export const delUser = data => ajax(BASE_URL + '/user/delUser', data, 'post', "json");

// addRecharge充值
export const addRecharge = data => ajax(BASE_URL + '/recharge/addRecharge', data, 'post', "json");

// admin获取所有订单
export const getAllOrders = (data) => ajax(BASE_URL + '/order/getAllOrders', data, 'get');
// 修改订单状态
export const reviseOrder = (data) => ajax(BASE_URL + '/order/reviseOrder', data, 'post');
// 删除订单
export const delOrder = (data) => ajax(BASE_URL + '/order/delOrder', data, 'post');


// 管理员获取全部留言信息
export const getAllMessages = (data) => ajax(BASE_URL + '/message/getAllMessages', data, 'get');
// 管理员或用户 删除留言
export const delMessage = (data) => ajax(BASE_URL + '/message/delMessage', data, 'post');




/*前台用户*/
//用户登录
export const userLogin = data => ajax(BASE_URL + '/user/userLogin', data, 'post');
//用户登录
export const getBikeDetail = data => ajax(BASE_URL + '/bike/getBikeDetail', data, 'get');

// 
// 点击租赁
export const addOrder = data => ajax(BASE_URL + '/order/addOrder', data, 'post');

// 用户留言
export const addMessage = data => ajax(BASE_URL + '/message/addMessage', data, 'post');
// 获取登录的用户信息
export const getUserInfo = data => ajax(BASE_URL + '/user/getUserInfo', data, 'get');

// 保存用户信息
export const saveUserInfo = data => ajax(BASE_URL + '/user/saveUserInfo', data, 'post');
// 修改密码
export const revisePwd = data => ajax(BASE_URL + '/user/revisePwd', data, 'post');

// 获取某用户所有订单
export const getUserOrders = data => ajax(BASE_URL + '/order/getUserOrders', data, 'get');

// // 获取所有文章
// export const getArticles = data => ajax(BASE_URL + '/article/getArticles', data, 'get');
 // 用户获取自己的充值记录
export const getUserRecharges = data => ajax(BASE_URL + '/recharge/getUserRecharges', data, 'get');
